{extend name="base/index"/}
{block name="page_location"}
<div class="row">
	<div class="col-12">
		<div class="page-title-box">
			<div class="page-title-right">
				<ol class="breadcrumb m-0">
					<li class="breadcrumb-item"><a href="{:url('index/index')}">管理中心</a></li>
					<li class="breadcrumb-item active"><i class="iconfont icon-angle-right"></i>广告管理</li>
				</ol>
			</div>
			<h4 class="page-title">
				所有广告
				<a href="{:url('ad/publish')}" class="btn btn-success btn-sm ml-3">发布广告</a>
			</h4>
		</div>
	</div>
</div>
{/block}
{block name="body"}
<div class="row" id="ad_page">
	<div class="col-12">
		<div class="card">
			<div class="card-body">
				<form action="" method="get"  id="search_frm">
					<div class="form-row align-items-center">
						<div class="col-auto">
							<label class="sr-only" for="inlineFormInputGroup"></label>
							<div class="input-group mb-2">
								<div class="input-group-prepend">
									<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"
									 aria-expanded="false">操作</button>
									<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
										<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="all" attr-bind="check_id">全选</a>
										<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="reverse" attr-bind="check_id">反选</a>
										<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="cancel" attr-bind="check_id">取消</a>
									</div>
								</div>
								<div class="input-group-addon">
									<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"
									 aria-expanded="false">操作选中</button>
									<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
										<a href="javascript:;" class="dropdown-item Fast_Bat" attr-type="enable" attr-model="ad" attr-class=".check_id">显示</a>
										<a href="javascript:;" class="dropdown-item Fast_Bat" attr-type="disable" attr-model="ad" attr-class=".check_id">不显示</a>
										<a href="javascript:;" class="dropdown-item Fast_Bat" attr-type="del" attr-model="ad" attr-class=".check_id">删除</a>										
									</div>
								</div>								
							</div>
						</div>
						<div class="col-auto">
							<label class="sr-only" for="inlineFormInputGroup"></label>
							<div class="input-group mb-2">
								<input type="text" class="form-control kw enter_goto" attr-event="search_btn" name="kw" placeholder="输入关键字" value="">
								<button type="button" class="input-group-append btn btn-primary search_btn" attr-ipt="kw" attr-url="{:url('ad/index')}">搜索</button>
							</div>
						</div>
						<div class="col-auto">
							<label class="sr-only" for="inlineFormInputGroup"></label>
							<div class="input-group mb-2">
								<a href="javascript:;" class="btn btn-primary" id="Fast_Sort" attr-model="ad" attr-frm="ad_list_frm">更新排序</a>
							</div>
						</div>
					</div>
				</form>
				<form action="" method="post" id="ad_list_frm">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>选择</th>
                            <th>广告编号</th>
                            <th>广告类型</th>
                            <th>广告标题</th>
                            <th>广告备注</th>
                            <th>创建时间</th>
                            <th>是否显示</th>
                            <th>排序</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {volist name='list' id="data"}
                            <tr>
	                            <td>
									<div class="custom-control custom-checkbox">
										<input type="checkbox" class="custom-control-input check_id" id="check_id{$data.id}" value="{$data.id}" name="check_id[]">
										<label class="custom-control-label" for="check_id{$data.id}">ID:{$data.id}</label>
									</div>	
	                            </td>
                                <td>{$data.aid}</td>
                                <td>
									{switch name="data.type" }
									{case value="1"}简单文本广告{/case}
									{case value="2"}编辑器广告{/case}
									{case value="3"}单个图片广告{/case}
									{case value="4"}多个图片广告{/case}
									{case value="5"}代码广告{/case}
									{case value="6"}幻灯广告{/case}
									{/switch}                                	
                                </td>
                                <td>{$data.title}</td>
                                <td>{$data.remark}</td>
                                <td><span class="badge badge-primary">{$data.posttime|date="y-m-d H:i",###}</span></td>
                                <td>
                                	{eq name="data.status" value="0"}
                                	<a href="javascript:;" attr-model="ad" attr-id="{$data.id}" attr-field="status" attr-val="1" class="badge badge-primary Fast_Action">启用</a>
                                	{else /}
                                	<a href="javascript:;" attr-model="ad" attr-id="{$data.id}" attr-field="status" attr-val="0" class="badge badge-secondary Fast_Action">禁用</a>
                                	{/eq}
                                </td>
                                <td>
									<input type="hidden" name="field_ids[]" value="{$data.id}" />
									<input type="number" class="form-control orderid_ipt" name="orderid_ipt[]" value="{$data.orderid}">                            	
                                </td>
                                <td>
                                    <a href="{:url('ad/publish')}?act=edit&id={$data.id}" class="btn btn-primary btn-sm edit_btn"><i class="iconfont icon-icon_compile"></i> 修改</a>
                                    <a href="javascript:;" class="btn btn-danger btn-sm Fast_Del" attr-model="ad"  attr-id="{$data.id}" ><i class="iconfont icon-icon_delete_fill"></i> 删除</a>
                                </td>
                            </tr>
                        {/volist}
                    </tbody>
                </table>
                </form>
				<div class="row">
					<div class="col-12" style="text-align: center;">
						{$pagelist}
					</div>
				</div>				
			</div>
		</div>
	</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__PLUGIN__/PCAS/PCASClass.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak={$Config.baidumap_ak}"></script>
{/block}